package com.sky.controller.user;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sky.entity.Setmeal;
import com.sky.result.Result;
import com.sky.service.user.UserSetmealService;
import com.sky.vo.DishItemVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user/setmeal")
@RequiredArgsConstructor
@Slf4j
public class UserSetmealController {
    private final UserSetmealService userSetmealService;

    @GetMapping("/list")
    public Result<List<Setmeal>> findById(@RequestParam Integer categoryId) {
        List<Setmeal> setmealList = userSetmealService.findById(categoryId);
        log.info("查询结果：{}", setmealList);
        return Result.success(setmealList);
    }

    @GetMapping("/dish/{id}")
    public Result<List<DishItemVO>> findBySetmealId(@PathVariable Integer id) {
        List<DishItemVO> dishItemVOList = userSetmealService.findBySetmealId(id);
        log.info("查询结果：{}", dishItemVOList);
        return Result.success(dishItemVOList);
    }
}
